\documentclass[11pt]{article}
\usepackage[draft,uselot,hylinks,titlepage,full]{boaz}

\title{\LaTeX\ Template for Writing Papers}
\author{Boaz Barak}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros for this paper

% BKMRK 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BEGIN BODY of Document


\begin{DOCheader}


\begin{abstract}This file is a template file for writing papers in \LaTeX.
The main features are:


\begin{enumerate}

\item General variables to switch easily between  working draft
and submitted version and between proceedings and full versions.
See \sectionref{sec:variables}.

\item Macros to help compile the article into a clickable PDF
document. See \sectionref{sec:crosref}

\item Some useful macros. See \sectionref{sec:macros}

\end{enumerate}

\end{abstract}
\DOCkeywords{\LaTeX , hyperlinks}

\end{DOCheader}

\section{How to use the template} \label{sec:howtouse}

\noindent\textbf{Note:} I assume that this is for installation on
a PC, and WinEDT, MikTeX, and Acrobat reader are already
installed.

\begin{enumerate}

\item Download {\tt boaztemplate.zip} file and extract it to its
own directory.

\item Rename {\tt template.tex} and {\tt template.bib} to {\tt
mypaper.tex} and {\tt mypaper.bib} (assuming that you want to name
your file {\tt mypaper}).

\item Open {\tt mypaper.tex} and change the title and author name
(at the top).

\item Delete the contents of the abstract (between
\verb!\begin{abstract}! and \verb!\end{abstract}!).

\item Delete the body of the document starting after the comment

\begin{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BEGIN BODY of Document
\end{verbatim}

and ending  before the comment

\begin{verbatim}
% END BODY of document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{verbatim}

(You can also delete the sample appendix)

\item Change the line \verb!\bibliography{template}! to
\verb!\bibliography{mypaper}! \Bnote{WinEDT behaves better when
.tex file and .bib file have the same name}

\item Type your paper as usual, when you refer to a section, use \verb!\sectionref{sec:crosref}! instead of
\verb!Section~\ref{sec:crosref}! (See \sectionref{sec:crosref} for
more details).

\item Don't forget to run \LaTeX\ or PDF-\LaTeX\ at least two times to get
references and links right. If you are using BibTeX then run
\LaTeX\ once, then BibTeX, and then  run \LaTeX\ twice (same goes
for PDF-\LaTeX).


\end{enumerate}

\subsection{Useful conventions}

\subsubsection{Bookmarks and macros.}

There is a place in the template to add your own macros. It is
marked with

\begin{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros for this paper
\end{verbatim}

I find it useful to always keep  WinEDT bookmark number 0
(Ctrl+Shift+0) pointing to this location so I can jump there
quickly when I add a macro. Keep book mark number 2 (Ctrl+Shift+2)
pointing to the current place you are in the document so you'll be
able to jump back.

\subsubsection{Labelling}

I find it useful to always label a section with the prefix {\tt
sec:} , a definition with the prefix {\tt def: } etc.. It also
helps with WinEDT because it sorts all the labels alphabetically.
When you refer to a label, don't forget to use
\verb!\sectionref{sec:macros}! instead of
\verb!Section~\ref{sec:macros}!

\subsubsection{Bibliography}

Use the following convention when using \verb!\cite{}! to refer to
a work: Full name of first author, two letters from every other
author and then two digits of year. Thus, if we want to refer to a
paper by Goldwasser, Micali and Rackoff from 1989
\cite{GoldwasserMiRa89}, we'll use \verb!\cite{GoldwasserMiRa89}!.
Of course, at some point you'll need to ensure that your file {\tt
mypaper.bib} indeed contains a BibTeX item with the appropriate
key. The easiest way to do so would be to be to search for a
BibTeX citation on the Collection of Computer Science
Bibliographies on \url{http://liinwww.ira.uka.de/bibliography/}.

When you find a citation, you  can copy and paste it into your
{\tt mywork.bib } file. Just don't forget to change the key
according to the convention above.

This is an example for a BibTeX citation for the paper
\cite{GoldwasserMiRa89} (as it is in the file {\tt template.bib}):

\begin{verbatim}
@article {GoldwasserMiRa89,
    AUTHOR = {Goldwasser, Shafi and Micali, Silvio and Rackoff, Charles},
     TITLE = {The knowledge complexity of interactive proof systems},
   JOURNAL = {SIAM J. Comput.},
  FJOURNAL = {SIAM Journal on Computing},
    VOLUME = {18},
      YEAR = {1989},
    NUMBER = {1},
     PAGES = {186--208},
      ISSN = {0097-5397},
     CODEN = {SMJCAT},
   MRCLASS = {68T15 (03F07 68Q15 94A60)},
  MRNUMBER = {90f:68157},
MRREVIEWER = {Robert M. Baer}, }
}
\end{verbatim}

\section{General variables} \label{sec:variables}

We have the following switches:

\begin{itemize}

\item {\tt full}: $1$ - Full version , $0$ - Proceeding version

\item {\tt draft}: $1$ - Working draft (show ``working draft'' on
title, show Author's notes) , $0$- submitted version

\item {\tt hylinks}: $1$ - Use the {\tt hyperref} package to generate
hyperlinks for cross-references, $0$ - don't


\item {\tt usetitlepage}: $1$ - Have the abstract and title on a
separate page , $0$ - don't.

\end{itemize}

\section{Hyperlinks and Cross-referencing} \label{sec:crosref}

To link to a section labeled \verb!sec:macros! use
\verb!\sectionref{sec:macros}!. The resulting link looks like
this: \sectionref{sec:macros}. There are also analogous commands
\verb!\definitionref! , \verb!\theoremref! etc. Thus it is
possible also to link to definitions, such as
\definitionref{def:rat} and theorems, such as
\theoremref{thm:irrat}.

When you site a work (such  as \cite{GoldwasserMiRa89}) using the
\verb!\cite! command, you also get a link to the bibliography.

\section{Useful macros} \label{sec:macros}

\subsection{Math Symbols (partial list)}
\newcommand{\seprt}{&}

\begin{tabular}{lllll}
\verb!\eqdef! : $\eqdef$   \seprt \verb!\N! : $\N$ \seprt
\verb!\R! : $\R$ \seprt \verb!\Z! : $\Z$ \seprt
\verb!\bits! :
$\bits$ \\
\verb!\getsr! : $\getsr$ \seprt \verb!\st! : $\st$ \seprt
\noindent \verb!\Ex! : $\Ex$ \seprt \verb!\e! : $\e$ \seprt
\verb!\To! : $\To$ \\
\verb!\ceil{}! : $\ceil{x}$ \seprt \verb!\floor{}! : $\floor{x}$
\seprt \verb!\angles{}! : $\angles{x,y,z}$
\end{tabular}

\subsection{Environments}

List of environments:

\begin{itemize}

\item  Theorems etc.: \textbf{theorem} , \textbf{claim} , \textbf{subclaim} (for a claim
inside a proof of a theorem) , \textbf{lemma} , \textbf{corollary}
, \textbf{conjecture} , \textbf{observation}.

\item Definitions etc.: \textbf{definition} ,
\textbf{construction}, \textbf{example} , \textbf{remark}

\end{itemize}

Some examples:

\begin{definition} \label{def:rat} A number $x \in \R$ is
\emph{rational} if there exist two numbers $m,n \in \Z$ such that
$x = \tfrac{n}{m}$.
\end{definition}

\begin{theorem} \label{thm:irrat} The number $\sqrt{2}$ is
not rational.
\end{theorem}

There's also a floating protocol environment, see
\protocolref{prot:2roundZK} for an example.


\begin{protocolf}{\label{prot:2roundZK} Generic bounded non-uniformity zero-knowledge protocol.}
\begin{tabular}{|p{11.9cm}|c|}
\hline
%
\noindent\textbf{Public input:}  $x \in \bits^n$ (statement to be
proved is ``$x \in L$'') &
%\parties{a}{b}{c}{d}{e} \\
\parties{P}{V}{\inp{w}}{\inp{x}}{} \\
\noindent\textbf{Prover's auxiliary input:} $w$ (a witness that $x
\in L$) & \\
%
\hline
%
\protStep{Send long random string}{Steps V1}{Verifier sends $r
\getsr \bits^{10n}$. } &
%
%\subprot{center}{a}{b}{c}{d}{e}{f} \\
\leftstep{r \getsr \bits^{10n}} \\
%
\protStep{WI Proof}{Step P2}{Prover proves to verifier using its
input $w$ via a witness-indistinguishable (WI) proof/argument
system that either $x \in L$ or $r \in \Lambda$, where $r \in
\Lambda$ iff there exists a Turing machine $M$ of description
length at most $\tfrac{|r|}{2}$ such that, on the empty input, $M$
outputs $r$ within $f(n)$ steps. Verifier accepts if proof is
completed successfully. } &
%
\subprot{%
 \boxed{\begin{minipage}{2cm}$WI\text{-}proof$ \\
 $x \in L$ \\\textbf{or} $r \in \Lambda$ \end{minipage}}
 }
 {\inp{w}}{\inp{x, r}}{}
 { }{ }{\outp{0/1}} \\
%
\hline
\end{tabular}

\begin{small}The right column contains a schematic description of the
protocol as defined in the left column. \end{small}
\end{protocolf}


\subsection{Complexity classes}
We use \verb!\classname! to produce $\P,\NP, \BPP, \Ppoly,
\EXP, \NEXP, \PCP , \Dtime, \Ntime$

\subsection{Author's note}

To define an Author's note command use a command like

\begin{quote}
\begin{verbatim}
\newcommand{\Bnote}[1]{{\authnote{Boaz}{#1}}}
\end{verbatim}
\end{quote}

The effect is as follows: \Bnote{The notes are not displayed if
one uses the {\tt draft=0} option.}

\section{The \texttt{boaz.sty} package}

The \texttt{boaz.sty} package contains the macros needed for most
of the above stuff. This document uses the line
\begin{quote}
\begin{verbatim}
\usepackage[draft,hylinks,notitlepage,full]{boaz}
\end{verbatim}
\end{quote}

\subsection{Package options}

\begin{description}

\item[hylinks/nohylinks] Use or don't use hyperlinks.

\item[draft/final]  Working draft (show author notes) or final version

\item[titlepage/notitlepage] Use/don't use a title page

\item[full/proceed] Full or proceeding version. Mainly changes
the \verb!full! variable, which you can use as follows:
\begin{quote}
\begin{verbatim}
\ifnum\full=1
 Write here the full proof
\else
 For proof see the full version of this paper.
\fi
\end{verbatim}
\end{quote}

This also changes the behavior of the command \verb!\nnspace!. In
\verb!proceed! mode this command causes a small negative vertical
space, while in \verb!full! mode it does nothing. It also changes
the behavior of the \verb!\newitem! command which is the same as
\verb!\item! in \verb!full! mode, and with a negative space in
\verb!proceed! mode.

\item[usetoc/nousetoc , uselot/nouselot , uselof/nouselof] Control whether or not
the table of contents, the list of tables and the list of figures
is displayed.
\end{description}

The default setting is
\textbf{full},\textbf{hylinks},\textbf{draft},\textbf{notitlepage},\textbf{usetoc},\textbf{nouselot},\textbf{nouselof}

\subsection{Important macros}

\begin{description}

\item[\texttt{DOCheader} environment] Use this environment around
your abstract, keywords and everything else you want in the top of
your document. Will create or not a title page based on the
\verb!titlpage! / \verb!notitlepage! option.

\item[\texttt{$\backslash$DOCkeywords} command] Use this command inside the
\verb!DOCheader! environment to state your papers keywords. The
keywords will appear only if there is a title page. Example:
\begin{quote}\begin{verbatim}
\DOCkeywords{\LaTeX , hyperlinks}
\end{verbatim}\end{quote}


\end{description}


% END BODY of document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bibligoraphy
\newpage

\bibliographystyle{alphabetic}
%\bibliographystyle{abbrv}

\bibliography{template}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Appendices:
\newpage

\appendix
\ifnum\hylinks=1 \phantomsection \fi
\addcontentsline{toc}{section}{Appendices}

\section{Sample Appendix}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
